package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {
	
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

	// 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
	public static String app_id = "2021000118650841";
	
	// 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQClTkO0H0/kHN/TMVPAUEJDutrIf4CS5kcS6wJPUSHfhFwuWJC8V5lk9wc426fumRiqwoQd6YMSiFmPNHlEI0yRTADmwse+NB7YyRwWh1nCmbxc4PMjfYY7nAoXsE+XD8HN6pSlsuu+F5WB+x1j50rDL4eRe6/atwzTw8+MZWK8snXoM9oTzGU4IB5w91u4qLDhLMzHFgXKi2ycphZWHtX/cJeE2N+IzX+WOXGaA5VVou5sCVBGHOAz9wlxV6+v80ysZeDp5UJgz6fDMAi3/TKlPhtxSEFzAcjWB/7GCXTg8AzmSfwXzeZUhxxYe0hx/LhZhQffJPpZLB/y5h0ZhnAPAgMBAAECggEAFbb3O9UVKJEGcfa72rpwSfdkwAvHtwRa98g5UHQG8BayCUCHGsajFtlAcJ6iK7yeuee9dTR0jF2u7hnliCbe6wNB5w5VMM4l8zJP50G2b9LEJKtEJThbBr+Tr9LwUZa3TbZv+mhLgXgVorJ7BOGgN42p0FmgGyoKnFLPk9DJrKHKgIed+Nki8POlGSJggE8J54JpokZkbWsT1tl2LTNyquvN9lTYZk5ycw+bL1erqu0bXBP5i1OWKXBSGwqS0teK1llvauP0dJwW+yuza9Q3g/C9bH936IgqBR65QluE3lJMi3PGVURKsVPugb2gO8ZkddeFrgS1f3Ysg8M+G+yg+QKBgQDioBL0HCtsBvzbjdA99bIL/GP6nKmxl+yZZosk6LZKVj3PprVUB3XwuWuafpUdMOWnsLTsoB/puzb7igJILCxkImylcYsxpmeOIA0/pWYi7Gt2dpBLR1RK36ANGbSjODEjd1A2h4MJX9OA8sqPWTdftENRKy51qDpy6pk3ydKNTQKBgQC6u3jfh8mKPjvpRMNU/cQOaV6KAURufYLdgJX2IsBrmB2cqCS2cKKAN5Zf7O2fHC6XyZfXq6n0RTuId0vzxMULZKV41hHTVelRDtmtC5VEWb+K+5WLas5GWN7gx9B0tUocjsEZxpKHYtOMerW/ziTSllRfYY1TWoKkJKV0Tu/0ywKBgAymNqidcecDtNVkYv0yW4/DtKjmWapp+nDNgnK68oHPsn+GpJReHj0jfFgRPK12bzse59pVTbK0GmuL1njEzm2AZmQNpGFPEnSiYVruFndYjt772y34e0H6nWpdxvFdT5DVNgr1IWFCkgGei6PYrPiQjTlYma1DiI+lfIvanf/5AoGAW5+zXpMFHBUPVpVL9v8RXTTsk3CtwD1Loh3+9yf0HJcmKIEEipRX1+vumCDsM38jiYz8OXHc0aPK41oN5Y2uVbnLy6/WTUlBU2mi+1rMoh4bczmhFiiREEl5CvhgW3O86qhNLbWWnmGqhaqMVZHz1XS375kxPC4UHjBxEtHMweMCgYBWTXYL6FElmaHEADrfpOfaGffV/2m52CmUB16eF8nzHVWblF1KvW4KQowXJG1hKWSW8EZooZ6mMF2D9RRGXyxs9fqLin/Z0aVKHnkbCOGaCE2LH7P4YyLIM5q9Uj0XRgpYm6lYN3TyKabNwVDRlWz0mhDahUN4RDACDCIZFXIozA==";
	
	// 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1h8wSBiHxhHj09UnB/MhkJSYRLO363T+FKfV82OwA9G/ZH9WyxLHofRo3HdnlXDEdspwYroW7rbpWd+z8S2ogeRq2x0SZb/uBrItWWFODi/Nq3kxBlKKJ0hAhVkJhX8pwb80OZJDrpLKloA1wtOLLd0pzriEcSHVnD7ZeylB4ywsSsHbptQacxUnIyV03i6+30p9soKptPyR5cub3gbWPrA2tX53PeuWhIGRDerbcqImAs/n/k2yRGIJHJ8lp4gRidSECX7rvpKfn12rd52ZM/0fwxiIMIEqMB+mf+yylMxHTOEji2p3r4ftxZ9fRIhgRbPJwoYqVuQPXcl5PskufwIDAQAB";

	// 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String notify_url = " http://localhost:8888/testjava_war_exploded/notify_url.jsp";

	// 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
	public static String return_url = " http://localhost:8888/testjava_war_exploded/PaySuccessfulServlet";

	// 签名方式
	public static String sign_type = "RSA2";
	
	// 字符编码格式
	public static String charset = "utf-8";
	
	// 支付宝网关
	public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";
	
	// 支付宝网关
	public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /** 
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

